package cn.njxzc.ppt;

/***
 * @Program Name : JavaProgram.ppt.Jex6_13.java
 * @Written by : Roy Xu
 * @Creation Date : 2016��4��5�� ����8:28:12
 * @version : v1.00
 * @Description :
 * @ModificationHistory Who When What -------- ----------
 *                      ------------------------------------------------ Roy Xu
 *                      2016��4��5������8:28:12 TODO
 ***/
class Spot1 {
	private double x, y;

	Spot1(double u, double v) {
		setX(u);
		setY(v);
	}

	void setX(double x1) {
		x = x1;
	}

	void setY(double y1) {
		y = y1;
	}

	double getX() {
		return x;
	}

	double getY() {
		return y;
	}

	/**
	 * 
	 * @Enclosing_Method : midSpot
	 * @Written by : Roy Xu
	 * @Creation Date : 2016��4��5�� ����8:28:18
	 * @version : v1.00
	 * @Description : �������������ķ���ֵ
	 * @param s2
	 * @return
	 * 
	 */
	Spot1 midSpot(Spot1 s2) {
		double midX = (x + s2.getX()) / 2;
		double midY = (y + s2.getY()) / 2;
		return new Spot1(midX, midY);
	}
}

class Jex6_13 {
	public static void main(String[] args) {
		Spot1 s1 = new Spot1(3.0, 5.0);
		Spot1 s2 = new Spot1(6.0, 8.0);
		System.out.println("s1������:" + s1.getX() + "," + s1.getY());
		System.out.println("s2������:" + s2.getX() + "," + s2.getY());
		Spot1 s = s1.midSpot(s2);
		System.out.println("�е�����:" + s.getX() + "," + s.getY());
	}
}
